<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023-04-10
  Time: 8:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>admin</title>
    <script>
        function del(){
            return confirm('del?');
        }
    </script>
</head>
<body>
<h1>admin page</h1>
<hr>
<%@include file="add.jsp"%>
<hr>
<table border="1">
    <tr>
        <th>ID</th>
        <th>TITLE</th>
        <th>TYPE</th>
        <th>DESCRIPTION</th>
        <th>ORIGINAL PRICE</th>
        <th>CURRENT PRICE</th>
        <th>PICTURE</th>
        <th colspan="2">OPERATIONS</th>
    </tr>
    <c:forEach var="product" items="${sessionScope.products}">
        <tr>
            <td>${product.id}</td>
            <td>${product.title}</td>
            <td>${product.type}</td>
            <td>${product.description}</td>
            <td>${product.originalPrice}</td>
            <td>${product.currentPrice}</td>
            <td><img src="/pictures/${product.picture}" width="30"></td>
            <td><a href="/product/queryById/${product.id}">edit</a> </td>
            <td><a href="/product/removeById/${product.id}" onclick="return del()">remove</a> </td>
        </tr>
    </c:forEach>
</table>
</body>
</html>
